﻿using Sustainalytics.Entities;
using System;
using System.ComponentModel.DataAnnotations;

namespace Sustainalytics.Services.Admin.WebApi.DTOs
{
    public class EventsDto
    {
        public Guid Id { get; set; }

        [Required]
        [MaxLength(100)]
        public string Name { get; set; }

        [Required]
        public string Body { get; set; }

        public Guid AddedByUserId { get; set; }

        [Required]
        public EventsStatus Status { get; set; }

        public EventsCategory Category { get; set; }

        [Required]
        [DataType(DataType.Date)]
        public DateTime DateCreated { get; set; }

        [Required]
        [DataType(DataType.Date)]
        public DateTime? UnpublishedDate { get; set; }

        [Required]
        public string Location { get; set; }

        public bool Sponsorship { get; set; }

        public string Presenter { get; set; }
        
        public void SaveToNew(Event data)
        {
            data.Id = this.Id;
            data.Name = this.Name;
            data.Body = this.Body;
            data.AddedByUserId = this.AddedByUserId;
            data.Status = this.Status;
            data.DateCreated = this.DateCreated;
            data.UnpublishedDate = this.UnpublishedDate;
            data.Location = this.Location;
            data.Sponsorship = this.Sponsorship;
            data.Presenter = this.Presenter;
        }
    }
}
